<?php

class Validate_Captcha extends Zend_Validate_Abstract
{
    const FALSE_CAPTCHA = 'falseCaptcha';

    /**
     * @var array
     */
    protected $_messageTemplates = array(
        self::FALSE_CAPTCHA => "The code '%value%' is false."
    );
    
	public function isValid($value)
	{
		if (Utils_Captcha::isValid($value, Utils_Captcha::getCurrentIdCaptcha())) {
			return true;
		}
		else {
			$this->_setValue($value);
			$this->_error(self::FALSE_CAPTCHA);
		}
		return false;
	}
}
